1. Technology Field
The present invention relates to a memory management and writing method and a rewritable non-volatile memory controller and a rewritable non-volatile memory storage system using the same.
2. Description of Related Art
Along with the widespread of digital cameras, cell phones, and MP3 in recently years, the consumers' demand to storage media has increased drastically. Rewritable non-volatile memory is one of the most adaptable memories for such battery-powered portable products due to its characteristics such as data non-volatility, low power consumption, small volume, and non-mechanical structure. A solid state drive (SSD) is a storage device which uses a rewritable non-volatile memory as its storage medium. Rewritable non-volatile memory has been broadly used for storing important personal data thanks to its small volume and large capacity. Thereby, the development and production of rewritable non-volatile memories have become a very important part of the electronic industry in recent years.
Generally speaking, a memory chip is composed of a plurality of physical blocks. Besides, a controller of a rewritable non-volatile memory storage system groups the physical blocks into a plurality of physical units and further logically groups these physical units into a data area and a spare area for managing the physical units. Those physical units in the data area are used for storing valid data written by write commands, and those physical units in the spare area are used for substituting the physical units in the data area when the write commands are executed. In order to allow a host to smoothly access the physical units alternatively used for storing data, the rewritable non-volatile memory storage system provides logical units to the host system. Namely, the rewritable non-volatile memory storage system establishes a logical unit-physical unit mapping table and records the mapping relationship between the logical units and the physical units in the data area in this table to reflect the alternation of the physical units. To be specific, when the rewritable non-volatile memory storage system receives a write command from the host system and is about to write new data into a logical unit, the controller of the rewritable non-volatile memory storage system gets a physical unit from the spare area and writes the valid old data in the physical unit originally mapped to the logical unit and the new data into the physical unit gotten from the spare area. Then, the controller of the rewritable non-volatile memory storage system erases the physical unit originally mapped to the logical unit and associates it to the spare area. After that, the controller of the rewritable non-volatile memory storage system maps the logical unit to the physical unit containing the new data (i.e., the physical unit containing the new data is associated with the data area) in the logical unit-physical unit mapping table. Thereby, the host system simply accesses the logical unit, while the controller of the rewritable non-volatile memory storage system performs data writing and reading on the corresponding physical unit according to the logical unit-physical unit mapping table.
Along with the increase of the capacity of each physical unit in the rewritable non-volatile memory, the time for moving the valid old data has been increased considerably. In order to increase the speed of moving the valid old data, manufacturers of rewritable non-volatile memory provide a copyback instruction set to shorten the time for moving data between physical units. However, in the circuit design of a rewritable non-volatile memory, the physical units composed of physical blocks respectively belong to different planes, and foregoing copyback instruction set is applicable to those physical units belonging to the same plane.
Thus, in existing memory management techniques, in order to apply the copyback instruction set, the controller of a rewritable non-volatile memory storage system groups the physical units into a plurality of physical unit groups according to the planes of the physical units, so as to manage these physical units respectively. Namely, each physical unit group has its own data area and spare area, and the alternation of the physical units is limited within each single physical unit group. Accordingly, the controller of the rewritable non-volatile memory storage system can successfully move the valid old data between the physical units by using the copyback instruction set.
The number of times that each physical unit (or physical block) in a rewritable non-volatile memory can be written or erased is limited, such as 10000 times. Particularly, since the physical units are alternatively used for storing data, when some of the physical units are damaged, the rewritable non-volatile memory storage system cannot be used anymore even as there are still good physical units. Thus, by grouping and managing the physical units in a plurality of physical unit groups, a specific physical unit group will be worn out faster than other physical unit groups if the host system always accesses the corresponding logical unit, such that the lifespan of the rewritable non-volatile memory storage system is shortened.
Nothing herein should be construed as an admission of knowledge in the prior art of any portion of the present invention. Furthermore, citation or identification of any document in this application is not an admission that such document is available as prior art to the present invention, or that any reference forms a part of the common general knowledge in the art.